<template>
    <div id="contentMargin">
        <div id="mui-content" class="mui-content" style="background-color:#fff">
            <h5 style="background-color:#efeff4;padding-left: 5px">商品列表</h5>
            <ul class="mui-table-view mui-grid-view">
                <li v-for="item in list" class="mui-table-view-cell mui-media mui-col-xs-6">
                    <router-link v-bind="{to:'/goods/goodsinfo/'+item.id}">
                        <img class="mui-media-object" :src="item.img_url">
                        <div class="mui-media-body">{{item.title}}</div>
                        <div class="desc">
                            <p>
                                <span>￥{{item.sell_price}}</span>
                                <s>￥{{item.market_price}}</s>
                            </p>
                            <p>
                                <h6 class="left">热卖中</h6>
                                <h6 class="right">剩{{item.stock_quantity}}件</h6>
                            </p>
                        </div>

                    </router-link></li>

            </ul>
        </div>

    </div>
</template>
<script>
    import common from "../../kits/common";

    export default {
        data() {
            return {
                pageindex:1,
                list:[
                    {
                        "id":87,
                        "title":"商品1 物品1 物件1",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img1.jpg",
                        "sell_price":2195,
                        "market_price":2499,
                        "stock_quantity":60
                    },{
                        "id":88,
                        "title":"商品2 物品2 物件2",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img2.jpg",
                        "sell_price":2595,
                        "market_price":2799,
                        "stock_quantity":78
                    },{
                        "id":16,
                        "title":"商品3 物品3 物件3",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img3.jpg",
                        "sell_price":2795,
                        "market_price":3299,
                        "stock_quantity":60
                    },{
                        "id":17,
                        "title":"商品4 物品4 物件4",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img1.jpg",
                        "sell_price":1195,
                        "market_price":2099,
                        "stock_quantity":60
                    },{
                        "id":18,
                        "title":"商品5 物品5 物件5",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img2.jpg",
                        "sell_price":2665,
                        "market_price":3699,
                        "stock_quantity":60
                    },{
                        "id":19,
                        "title":"商品6 物品6 物件6",
                        "add_time":"2017-7-7",
                        "zhaiyao":"这是short内容",
                        "click":4,
                        "img_url":"../../../statics/imgs/img1.jpg",
                        "sell_price":2195,
                        "market_price":2499,
                        "stock_quantity":60
                    },
                ]
            }
        },
        created() {
            this.getlist();
        },
        methods: {
            getlist(){
                var url = common.apidomain+'api/...'+this.pageindex;
                this.$http.get(url).then(res=>{
                    if(res.body.status!=0){
                        alert(res.body.message);
                        return ;
                    }
                    this.list = res.body.message;
                })
            }
        }
    }
</script>
<style scoped>
    #mui-content li {
        border: 1px solid rgba(0, 0, 0, 0.4);
        margin-left: 4px;
        -wekit-box-shadow: 0 0 4px #000;
        -moz-box-shadow: 0 0 4px #000;
        padding: 4px;
    }

    #mui-content .mui-media-body {
        color: black;
    }

    #mui-content .desc {
        text-align: left;
        margin-top: 5px;
        height: 45px;
        background-color: rgba(0, 0, 0, 0.1);
    }
    #mui-content .desc span{
        color: red;
        margin-right: 15px;
    }
    .desc .left{
        position: absolute;
        left: 5px;
        bottom: 0;
    }
    .desc .right{
        position: absolute;
        right: 5px;
        bottom: 0;
    }
    #mui-content a {
        padding-left: 0;
        margin-left: 0;
    }
</style>